#!/bin/bash

# pip install supervisor

# chmod 777 -R /opt

# 初始化
python3 /opt/iClouds/manage.py inited

# 启动服务
supervisord -c /opt/supervisor/supervisord.conf

# 检查启动目录
# bash /opt/iClouds/excdirs.sh

# # 启动初始化
# python3 /opt/iClouds/manage.py inited >>/opt/logs/start.log

# # 启动celery worker, # 启动celery beat
# cd /opt/iClouds
# nohup celery -A iClouds worker -l INFO --logfile=/opt/logs/celery_worker.log &
# nohup celery -A iClouds beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler --logfile=/opt/logs/celery_beat.log &

# # 用于生产环境的项目启动 多线程
# uwsgi /opt/iClouds/uwsgi.ini

# # 阻塞进程
# # tail -f /opt/ver.log

# # 异步关闭 立即返回
# # celery multi stop w1

# # 异步关闭 立即返回
# PROCESS=`ps -ef|grep celery|grep -v grep|grep -v PPID|awk '{ print $2}'`
# for i in $PROCESS
# do
#     echo "Kill the $1 process [ $i ]"
#     kill -9 $i
# done